package elkaiyohrempfeil;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

public class MenuBar extends JMenuBar 
{
        private JMenu file, program, view;
        private JMenuItem fileOpen, exit, statusBar;
        private MainFrame mF;
        
        public MenuBar(MainFrame mainFrame) 
        {
                mF = mainFrame;
                program = new JMenu("GIS4Ships");
                add(program);
                exit = new JMenuItem("Exit");
                exit.addActionListener(new ActionListener() 
                {       
                    public void actionPerformed(ActionEvent arg0) 
                    {       
                            System.exit(0);
                    }
                });             
                program.add(exit);

                file = new JMenu("File");
                add(file);
                fileOpen = new JMenuItem("Open...");
                file.add(fileOpen);
                fileOpen.addActionListener(new ActionListener() 
                {       
                    public void actionPerformed(ActionEvent e) 
                    {
                            mF.openFile();
                    }
                });
                
                view = new JMenu("View");
                add(view);
                statusBar = new JMenuItem("Statusbar");
                view.add(statusBar);
                statusBar.addActionListener(new ActionListener() 
                {       
                    public void actionPerformed(ActionEvent arg0) 
                    {
                            mF.switchStatusbar();
                    }
                });
        }
}
